package hxy.bytecode.element;

import com.alibaba.fastjson.JSONObject;
import lombok.Data;

@Data
public class ObjectToByte {
    String fieldValue;
    public static void main(String[] args) {
        //对象序列化
        ObjectToByte objectToByte = new ObjectToByte();
        objectToByte.fieldValue="a";

        String toJSONString = JSONObject.toJSONString(objectToByte);
        System.out.println(toJSONString);
        byte[] bytes = toJSONString.getBytes();
        for (byte aByte : bytes) {
            System.out.println(aByte);
        }
    }
}
